{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3, 4, 5]\n",
      "[1, 2, 3, 4, 5]\n",
      "[1, 2, 3, 4, 5]\n",
      "[5]\n"
     ]
    }
   ],
   "source": [
    "a = [ 1,2,3,4,5 ]\n",
    "print(a[0:])# [1, 2, 3, 4, 5]\n",
    "print(a[:])#  [1, 2, 3, 4, 5]\n",
    "print(a[:100])# [1, 2, 3, 4, 5]\n",
    "print(a[-1:])# [5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "\n",
    "\n",
    " elif  关键字是用于给 if 语句添加其他条件语句的\n",
    "\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'''\n",
    "\n",
    "    假设你有一个变量 \"example\"，如何判断它的类型？\n",
    "\n",
    "'''\n",
    "\n",
    "example = \"adb\"\n",
    "type(example)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "example2 = 100\n",
    "type(example2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "exbmple \n",
      "\n",
      "example\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "     将字符串 \"example\" 中的字母 a 替换为字母 b，以下代码正确的是？\n",
    "\n",
    "'''\n",
    "\n",
    "str = 'example'\n",
    "result = str.replace('a','b')\n",
    "print(result,'\\n')\n",
    "print(str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "\n",
    "        正确的读取一个文件  f = open(\"test.txt\", \"r\")。\n",
    "\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#   测验 - 操作符\n",
    "\n",
    "\n",
    "'''\n",
    "\n",
    "    1、3*1**3 表达式输出结果为 3\n",
    "    \n",
    "       解释： ** 拥有更高的优先级。\n",
    "       \n",
    "       \n",
    "       \n",
    "    2、9//2 表达式输出结果为 4\n",
    "    \n",
    "        解释：// 用于向下取接近除数的整数。\n",
    "        \n",
    "        \n",
    "        \n",
    "    3、以下代码输出结果为 yes\n",
    "    \n",
    "        x = True\n",
    "        y = False\n",
    "        z = False\n",
    "\n",
    "        if x or y and z:\n",
    "            print(\"yes\")\n",
    "        else:\n",
    "            print(\"no\")\n",
    "\n",
    "        解释：and 拥有更高优先级，会先行运算。\n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "        优先级顺序为 NOT、AND、OR。\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "'''"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
